//
//  CollectListViewController.m
//  iOS-CtrlV
//
//  Created by Wang Li on 12-12-27.
//  Copyright (c) 2012年 Wang Li. All rights reserved.
//

#import "CollectListViewController.h"
#import "MainTabBarController.h"
#import "OwnViewController.h"
@interface CollectListViewController ()

@end

@implementation CollectListViewController
@synthesize m_Collect_ID;
@synthesize m_UserID;
@synthesize type = m_type;
- (id)init
{
    if (self =[super init]) {
        // Custom initialization
    }
    return self;
}
-(void) dealloc
{
    [m_UserID release];
    [m_Collect_ID release];
    [super dealloc];
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self.view setBackgroundColor:[UIColor colorWithRed:193/255.f green:193/255.f blue:193/255.f alpha:1]];
    
    AppDelegate* tAppDel = (AppDelegate*)[UIApplication sharedApplication].delegate;
    if([self.navigationController.navigationBar respondsToSelector:@selector(setBackgroundImage:forBarMetrics:)] ) {
        [self.navigationController.navigationBar setBackgroundImage:tAppDel.m_MidNavImg forBarMetrics: UIBarMetricsDefault];
        self.navigationController.navigationBar.clipsToBounds = NO;
    }
    
    _BackBttBarItem =[UIButton buttonWithType:UIButtonTypeCustom];
    _BackBttBarItem.frame =CGRectMake(0, 0, 44, 44);
    [_BackBttBarItem setImage:[UIImage imageNamed:@"navback.png"] forState:UIControlStateNormal];
    [_BackBttBarItem addTarget:self action:@selector(navBackBtt) forControlEvents:UIControlEventTouchUpInside];
    [_BackBttBarItem retain];
    [self.navigationController.navigationBar addSubview:_BackBttBarItem];
    
    

    if ([m_UserID length] > 0) {
        self.m_RquestURL = [NSString stringWithFormat:@"%@?app=blog&act=collectBlogs&user_id=%@&collect_id=%@",RequestMainURL,m_UserID,m_Collect_ID];
    }else{
        self.m_RquestURL = [NSString stringWithFormat:@"%@?app=blog&act=collectBlogs&collect_id=%@",RequestMainURL,m_Collect_ID];
    }
    [self firstDataGet];
}

-(void) viewWillDisappear:(BOOL)animated
{
    [_BackBttBarItem removeFromSuperview];
}

-(void) viewWillAppear:(BOOL)animated
{
    if ([_BackBttBarItem superview] ==nil) {
        [self.navigationController.navigationBar addSubview:_BackBttBarItem];
    }

}

//退出
-(void) navBackBtt
{

    [self.navigationController popViewControllerAnimated:YES];
}

@end
